package com.netrust.quarz.task.schedled;

import org.quartz.Trigger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

@Configuration
public class SchedulerFactory {
	@Autowired
	@Qualifier("bulidRealAlarmCronTriggerBean")
	CronTriggerFactoryBean bac;
	@Autowired
	@Qualifier("bulidHistoryAlarmCronTriggerBean")
	CronTriggerFactoryBean bhac;
	@Autowired
	@Qualifier("bulidStateCronTriggerBean")
	CronTriggerFactoryBean bsc;
	
	
    @Bean(name="schedulerFactoryBean") 
    public SchedulerFactoryBean schedulerFactory(){
    	SchedulerFactoryBean schedulerFactory = new SchedulerFactoryBean (); 
        Trigger[] ts=new Trigger[]{bac.getObject(),bhac.getObject(),bsc.getObject()};
        
        schedulerFactory.setTriggers(ts);
        return schedulerFactory;  
    }  
}
